<!-- 模板 -->
<template>
  <div class="waitPay">
    <el-card shadow="hover">
      <div>
        <i class="el-icon-search" />
        <span>筛选搜索</span>
        <el-button
          style="margin-left: 20px;"
          type="primary"
          size="small"
          icon="el-icon-search"
          @click="search"
        >
          搜索
        </el-button>
        <!-- <el-button icon="el-icon-refresh" size="small" @click="resetParams">
          重置
        </el-button> -->
      </div>
      <div style="margin-top: 15px">
        <el-form
          :inline="true"
          :model="params"
          size="small"
          label-width="140px"
        >
          <el-form-item label="姓名:" >
            <el-input
              v-model="params.realName"
              placeholder="输入姓名"
              clearable
              @clear="search"
            />
          </el-form-item>
           <el-form-item label="身份证号:"  >
            <el-input
              v-model="params.identityCard"
              placeholder="输入身份证号"
              clearable
              @clear="search"
            />
          </el-form-item>
          <el-form-item label="手机号:" >
            <el-input
              v-model="params.phone"
              placeholder="输入手机号"
              clearable
              @clear="search"
            />
          </el-form-item>
        </el-form>
      </div>
    </el-card>

   <div style="margin-bottom:10px"></div>
    <el-card shadow="hover">
        <span>待支付报名列表</span>
        <el-form
          :inline="true"
          :model="params"
          size="small"
          style="margin-top:10px"
        >
        <el-form-item label="分类名称:">
              <el-select v-model="params1.name" placeholder="请选择分类"  filterable @change="search1">
                  <el-option
                  v-for="item in classOptions"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id">
                  </el-option>
              </el-select> 
          </el-form-item>
          <el-form-item>
            <el-button
          type="primary"
          icon="el-icon-plus"
          style="margin-left: 20px;"
          size="small"
          @click="xinzeng"
          >新增</el-button
        >
          </el-form-item>
        </el-form>
        <el-table
          style="margin-top:20px"
          :data="tableData"
          border
          class="table"
          ref="multipleTable"
          header-cell-class-name="table-header"
        >
          <el-table-column type="index" label="编号" align="center" />
           <el-table-column
            label="头像"
            min-width="150"
            align="center"
          >
            <template slot-scope="scope">
              <img :src="showUrl+scope.row.url" alt="" width="80" height="80">
            </template>
          </el-table-column>
          <el-table-column
            prop="realName"
            label="姓名"
            align="center"
            min-width="150"
            :show-overflow-tooltip="true"
          ></el-table-column>
           <el-table-column
            prop="identityCard"
            label="身份证号"
            align="center"
            min-width="150"
            :show-overflow-tooltip="true"
          ></el-table-column>
           <el-table-column
            prop="phone"
            label="手机号"
            align="center"
            min-width="150"
            :show-overflow-tooltip="true"
          ></el-table-column>
          <template v-for="(item, index) in tableHead">
            <el-table-column align="center" :label="item.name" :key="index" :show-overflow-tooltip="true"  min-width="130">
              <template slot-scope="scope">
                {{ scope.row[item.mesName]}}
              </template>
            </el-table-column>
          </template>
           <!-- <el-table-column
            prop="mes17"
            label="姓名"
            align="center"
            min-width="150"
            :show-overflow-tooltip="true"
          >
           <template slot-scope="scope">
             <el-link   @click="chakan(scope.row)">{{scope.row.realName}}</el-link>
            </template>
          </el-table-column>
          <el-table-column
            label="头像"
            min-width="150"
            align="center"
          >
            <template slot-scope="scope">
              <img :src="showUrl+scope.row.headPortrait" alt="" width="80" height="80">
            </template>
          </el-table-column>
           <el-table-column
            prop="mes5"
            label="身份证号"
            align="center"
            min-width="150"
            :show-overflow-tooltip="true"
          ></el-table-column>
           <el-table-column
            prop="mes6"
            label="手机号"
            align="center"
            min-width="150"
            :show-overflow-tooltip="true"
          ></el-table-column>
           <el-table-column
            prop="certificateName"
            label="报名项目"
            align="center"
            min-width="150"
            :show-overflow-tooltip="true"
          ></el-table-column>
          <el-table-column
            prop="createTime"
            label="报名时间"
            align="center"
            min-width="150"
            :show-overflow-tooltip="true"
          ></el-table-column>
          <el-table-column
            prop="education"
            label="学历"
            align="center"
            min-width="150"
          ></el-table-column>
          <el-table-column
            prop=" location"
            label="常驻地"
            min-width="150"
            align="center"
            :show-overflow-tooltip="true"
          >
            <template slot-scope="scope">
              <span>{{ scope.row.location }}</span>
            </template>
          </el-table-column>
          <el-table-column
            prop="title"
            label="职称"
            align="center"
            min-width="150"
          ></el-table-column>
          <el-table-column
            prop="companyName"
            label="供职单位名称"
            align="center"
            min-width="150"
          ></el-table-column>
          <el-table-column
            prop="duties"
            label="职务"
            align="center"
            min-width="150"
          ></el-table-column>
          <el-table-column
            prop="payMoney"
            label="价格"
            align="center"
            min-width="150"
          ></el-table-column>
           <el-table-column label="状态" align="center" min-width="150">
             {{status}}
          </el-table-column>
            <el-table-column
            prop="payMoney"
            label="金额"
            align="center"
            min-width="150"
          ></el-table-column>
          <el-table-column label="是否需要发票" align="center" min-width="150">
            <template slot-scope="scope">
              <span>{{ scope.row.invoiceStatus == 0?"不需要":scope.row.invoiceStatus == 1?"需要":'' }}</span>
            </template>
          </el-table-column>
           <el-table-column
            prop="name"
            label="公司名称"
            align="center"
            min-width="150"
            :show-overflow-tooltip="true"
          ></el-table-column>
          <el-table-column
            prop="invoiceAmount"
            label="订单金额"
            align="center"
            min-width="150" 
          ></el-table-column>
          <el-table-column
            prop="dutyParagraph"
            label="税号"
            align="center"
            min-width="150"
             :show-overflow-tooltip="true"
          ></el-table-column>
          <el-table-column
            prop="invoiceAddress"
            label="邮寄地址"
            align="center"
            min-width="150"
             :show-overflow-tooltip="true"
          ></el-table-column>
          <el-table-column
            prop="invoiceRemark"
            label="发票备注"
            align="center"
            min-width="150"
             :show-overflow-tooltip="true"
          ></el-table-column> -->

            <el-table-column
            prop="payMoney"
            label="金额"
            align="center"
            min-width="100"
          ></el-table-column>
          <!-- <el-table-column label="状态" align="center"  prop="state" min-width="100"></el-table-column> -->
           <!-- <el-table-column
            prop="invoiceRemark"
            label="备注"
            align="center"
            min-width="150"
             :show-overflow-tooltip="true"
          ></el-table-column> -->
          <el-table-column
            label="操作"
            min-width="280"
            align="center"
            fixed="right"
          >
            <template slot-scope="scope">
              <el-button
                type="text"
                icon="el-icon-delete"
                @click="shanchu(scope.row)"
                >删除</el-button>
                <el-button
                type="text"
                icon="el-icon-coin"
                @click="daijiao(scope.row)"
                >代缴</el-button>
                <el-button
                type="text"
                icon="el-icon-coin"
                @click="daijiao1(scope.row)"
                >手动代缴</el-button>
                <el-button
                type="text"
                icon="el-icon-edit"
                @click="update(scope.row)"
                >编辑</el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-card>
<div class="pagination">
        <pagination
          v-show="pageTotal > 0"
          :total="pageTotal"
          :page.sync="params.pageNum"
          :limit.sync="params.pageSize"
          @pagination="getData00"
        />
      </div>
      <!-- 新增弹窗 -->
    <el-dialog :title=title :visible.sync="open" width="45%">
      <el-form ref="form" :model="form" label-width="120px" :rules="rules">
         <el-row :gutter="20">
            <el-col :span="12">
        <!-- <el-form-item label="选择类型" >
              <el-select v-model="form.type" placeholder="请选择分类"  filterable @change="handleClass" style="width:230px">
                      <el-option
                      v-for="(item,index) in classOptions"
                      :key="index"
                      :label="item.name"
                      :value="item.id">
                      </el-option>
                  </el-select> 
            </el-form-item> -->
            <el-form-item label="头像" prop="url">
                <el-upload
                  :headers="headers"
                  :action="`${baseUrl}/goods/goods/upload`"
                  :show-file-list="false"
                  :on-success="uploadPicUrl"
                  class="avatar-uploader"
                >
                  <img v-if="form.url" :src="showUrl + form.url" class="avatar" />
                  <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                </el-upload>
            </el-form-item>
            </el-col>
        <el-col :span="12">
            <el-form-item label="选择类型" >
                <el-select v-model="form.type" placeholder="请选择分类"  filterable @change="handleClass" style="width:230px">
                        <el-option
                        v-for="(item,index) in classOptions"
                        :key="index"
                        :label="item.name"
                        :value="item.id">
                        </el-option>
                    </el-select> 
            </el-form-item>
          </el-col>
        </el-row>
         <el-row :gutter="20">
            <el-col :span="12">
              <el-form-item label="姓名" prop="realName">
                <el-input v-model="form.realName"></el-input>
              </el-form-item>
            </el-col>
        <el-col :span="12">
              <el-form-item label="身份证号" prop="identityCard">
                <el-input v-model="form.identityCard"></el-input>
              </el-form-item>
            </el-col>
        </el-row>
         <el-row :gutter="20">
            <el-col :span="12">
              <el-form-item label="手机号" prop="phone">
                <el-input v-model="form.phone"></el-input>
              </el-form-item>
            </el-col>
        <!-- <el-col :span="12">
              <el-form-item label="选择类型" >
              <el-select v-model="form.type" placeholder="请选择分类"  filterable @change="handleClass" style="width:230px">
                      <el-option
                      v-for="(item,index) in classOptions"
                      :key="index"
                      :label="item.name"
                      :value="item.id">
                      </el-option>
                  </el-select> 
            </el-form-item>
          </el-col> -->
        </el-row>
       
        <div v-for="(item, index) in bjForm" :key="index" >
              <el-form-item :label="item.name" v-show="item.inputType == '输入框' && item.required == 1" :prop="item.mesName" :rules ="[{ required: true, message: '请输入内容', trigger: 'blur' },]">
                  <el-input v-model="form[item.mesName]" :placeholder=placTitle+item.name clearable style="width:230px"></el-input>
              </el-form-item>
                 <el-form-item :label="item.name" v-show="item.inputType == '输入框' && item.required == 0" >
                  <el-input v-model="form[item.mesName]" :placeholder=placTitle+item.name clearable style="width:230px"></el-input>
                </el-form-item>
                <!-- <el-form-item    :label="item.name" v-if="item.inputType == '输入框' && item.required == 1"   :prop="item.mesName" :rules ="[{ required: true, message: '请输入内容', trigger: 'blur' },]">
                    <el-input v-model="form[item.mesName]" :placeholder=item.name clearable
                        style="width: 80%;"></el-input>
                </el-form-item>
                <el-form-item :label="item.name" v-if="item.inputType == '输入框'  && item.required == 0" >
                    <el-input v-model="form[item.mesName]" :placeholder=item.name clearable
                        style="width: 80%;"></el-input>
                </el-form-item> -->

                  <el-form-item :label="item.name" v-show="item.inputType == '日期' && item.required == 1" :prop="item.mesName" :rules ="[{ required: true, message: '请输入内容', trigger: 'blur' },]">
                     <el-date-picker v-model="form[item.mesName]"  value-format="yyyy-MM-dd " type="date" placeholder="选择日期" @change="changeTime"></el-date-picker>
                  </el-form-item>
                  <el-form-item :label="item.name" v-show="item.inputType == '日期' && item.required == 0" >
                     <el-date-picker v-model="form[item.mesName]"  value-format="yyyy-MM-dd " type="date" placeholder="选择日期" @change="changeTime"></el-date-picker>
                  </el-form-item>

               <el-form-item :label="item.name" v-show="item.inputType == '多选' && item.required == 1" :prop="item.mesName" :rules ="[{ required: true, message: '请输入内容', trigger: 'blur' },]">
                  <el-checkbox-group v-model="form[item.mesName]">
                    <el-checkbox :label="item1.optiones" v-for="(item1,index1) in item.optionList" :key="index1">{{item1.optiones}}</el-checkbox>
                  </el-checkbox-group>
               </el-form-item>
               <el-form-item :label="item.name" v-show="item.inputType == '多选' && item.required == 0" >
                  <el-checkbox-group v-model="form[item.mesName]">
                    <el-checkbox :label="item1.optiones" v-for="(item1,index1) in item.optionList" :key="index1">{{item1.optiones}}</el-checkbox>
                  </el-checkbox-group>
               </el-form-item>

               <el-form-item :label="item.name" v-show="item.inputType == '单选' && item.required == 1" :prop="item.mesName" :rules ="[{ required: true, message: '请输入内容', trigger: 'blur' },]">
                  <el-radio v-model="form[item.mesName]" :label="item2.optiones" v-for="(item2,index2) in item.optionList" :key="index2">{{item2.optiones}}</el-radio>
               </el-form-item>
               <el-form-item :label="item.name" v-show="item.inputType == '单选' && item.required == 0" >
                  <el-radio v-model="form[item.mesName]" :label="item2.optiones" v-for="(item2,index2) in item.optionList" :key="index2">{{item2.optiones}}</el-radio>
               </el-form-item>

               <el-form-item :label="item.name" v-show="item.inputType == '字典表' && item.required == 1"  :prop="item.mesName" :rules ="[{ required: true, message: '请输入内容', trigger: 'blur' },]">
                    <el-select v-model="form[item.mesName]" :placeholder=placTitle1+item.name style="width: 65%;"  multiple   @change="((val)=>{changeName(val,item)})">
                        <el-option
                          v-for="(item2,index2) in item.sysDictData" 
                          :key="index2"
                          :label="item2.dictLabel" 
                          :value="item2.dictLabel">
                        </el-option>
                    </el-select> 
                </el-form-item>
                <el-form-item :label="item.name" v-show="item.inputType == '字典表' && item.required == 0"  >
                    <el-select v-model="form[item.mesName]" :placeholder=placTitle1+item.name style="width: 65%;"  multiple   @change="((val)=>{changeName(val,item)})">
                        <el-option
                          v-for="(item2,index2) in item.sysDictData" 
                          :key="index2"
                          :label="item2.dictLabel" 
                          :value="item2.dictLabel">
                        </el-option>
                    </el-select> 
                </el-form-item>
        </div>
        <el-form-item label="金额" >
              <el-input-number v-model="form.payMoney" disabled></el-input-number>
        </el-form-item>

      </el-form>
      <span slot="footer" class="dialog-footer" v-if="showBtn">
        <el-button @click="openqx">取 消</el-button>
        <el-button type="primary" @click="okopen">确 定</el-button>
      </span>
    </el-dialog>

<!-- 支付弹窗 -->
    <el-dialog
  title="微信支付"
  :visible.sync="wxDialogVisible"
  width="30%">
  <div style="width: 213px;margin:auto">
    <qriously :value="wxPay" :size="213" />
  </div>
  <span slot="footer" class="dialog-footer">
    <el-button @click="wxDialogVisible = false">取 消</el-button>
    <el-button type="primary" @click="wxDialogVisible = false">确 定</el-button>
  </span>
</el-dialog>
    <el-dialog
  title="支付方式"
  :visible.sync="TypeDialogVisible"
  width="30%">
  <!-- <div style="width: 213px;margin:auto">
    <qriously :value="payFrom.payment" :size="213" />
  </div> -->
    <el-select v-model="payFrom.payment"  placeholder="请选择">
      <el-option
        v-for="item in payOptions"
        :key="item.value"
        :label="item.label"
        :value="item.value">
      </el-option>
    </el-select>
  <span slot="footer" class="dialog-footer">
    <el-button @click="TypeDialogVisible = false">取 消</el-button>
    <el-button type="primary" @click="sumitPayment">确 定</el-button>
  </span>
</el-dialog>
  </div>
</template>

<script>
  import {
    queryorder_school,nijisiai,daijiao,daijiao1,delorder_school,nijisiai1,getOrder,getRegistration,getClassList1,delReg,
    getQueryName,getadd,getRegistrationXq,getUp
  } from "@/api/order/orderschool";
import { getToken } from "@/utils/auth";
import { listType,  } from "@/api/system/dict/type";
import QRCode from "qrcodejs2";

export default {
  name: '',
  data () {
    return {
      headers: { Authorization: "Bearer " + getToken() },
      baseUrl: process.env.VUE_APP_BASE_API,
      tableData:[],
      options:[],
      options1:[],
      rules:{
         url: [
            { required: true, message: '请添加头像', trigger: 'blur' },
          ],
        //   // qrCode: [
        //   //   { required: true, message: '请添加二维码', trigger: 'blur' },
        //   // ],
           realName: [
            { required: true, message: '请输入姓名', trigger: 'blur' },
          ],
           identityCard: [
            { required: true, message: '请输入身份证', trigger: 'blur' },
            { pattern: /^[1-9]{1}[0-9]{14}$|^[1-9]{1}[0-9]{16}([0-9]|[xX])$/,message: '请输入正确的证件号'},
          ],
          phone: [
            { required: true, message: '请输入手机号', trigger: 'blur' },
            { pattern: /^1[3456789]\d{9}$/,message: '请输入正确的手机号'},
          ],
        //    certificateName: [
        //     { required: true, message: '请选择报考项目', trigger: 'change' },
        //   ],
        //     location: [
        //     { required: true, message: '请输入常驻地', trigger: 'blur' },
        //   ],
        //   education: [
        //     { required: true, message: '请选择学历', trigger: 'change' },
        //   ],
        //   certificationDate: [
        //     { required: true, message: '请选择发证日期', trigger: 'blur' },
        //   ],
        //   title: [
        //     { required: true, message: '请输入职称', trigger: 'blur' },
        //   ],
        //   companyName: [
        //     { required: true, message: '请输入供职单位名称', trigger: 'blur' },
        //   ],
        //   duties: [
        //     { required: true, message: '请输入职务', trigger: 'blur' },
        //   ],
      },
      params: {
        pageNum: 1,
        pageSize: 10,
        type:undefined,
        examineStatus:2,
        state:1,
      },
       params1: {
        pageNum: 1,
        pageSize: 10,
        state:1,
        name:'',
      },
      pageTotal:0,
      open:false,
      showOpen:true,
      showBtn:true,
      title:"",
      loading: true,
      form:{
        url: "",
        state:undefined,
        type:'',
        // orderSource:"",
        examineStatus:"",
        payMoney:'',
        realName:'',
        phone:'',
        identityCard:'',
        // qrCode:'',
        mes1:'',
        mes2:'',
        mes3:'',
        mes4:'',
        mes5:'',
        mes6:'',
        mes7:'',
        mes8:'',
        mes9:'',
        mes10:'',
        mes11:'',
        mes12:'',
        mes13:'',
        mes14:'',
        mes15:'',
        mes16:'',
        mes17:'',
        mes18:'',
        mes19:'',
        mes20:'',
      },
      payFrom:{
        id:undefined,
        payment:undefined,
      },
      TypeDialogVisible:false,
      status:"待支付",
      wxDialogVisible:false,
      wxPay:"",
      orderSn:'',
      index:0,
      payOptions:[
        {
          value: 1,
          label: '微信'
        }, {
          value: 2,
          label: '支付宝'
        },{
          value: 4,
          label: '对公转账'
        },
      ],
      options2:[
        {
          value: 0,
          label: '不需要'
        }, {
          value: 1,
          label: '需要'
        }
      ],
      classOptions:[],
      classOptions1:[],
      tableHead:[],
      Dname:undefined,
      Dmobile:undefined,
      Dnumber:undefined,
      bjForm:[],
      dictList:[],
      placTitle:'请输入',
      placTitle1:'请选择',
      text:[],
      list:[],
      duoList:[],
    }
  },
  props: [],
  components: {},
  computed: {},
  filters: {},
  watch: {
        // 支付扫码轮询是否付款
    QrForm (newVal,oldVal) {
      this.getUser()
    },
  },
  methods: {
    changeTime(value) {
      console.log(value);
    },
    handleClass(val){
          let that = this
      // console.log(val);
      getQueryName(val).then(res =>{
        if(res.code == 200){
          // console.log(res);
          that.bjForm = res.data
          // that.form.mes13 = ''
           console.log(that.form);
          for (let i = 0; i < that.bjForm .length; i++) {
            if(that.bjForm[i].dictType == 'sys_enter'){
              that.options1 = that.bjForm[i].sysDictData
            }
            if(that.bjForm[i].inputType == '日期'){
              console.log(123);
              that.$nextTick(res =>{
              that.form[that.bjForm[i].mesName] = ''
              })
            }
          }
        }
      })
    },
    sumitPayment(){
      // console.log(this.payFrom);
      daijiao1(this.payFrom).then(res=>{
          if(res.code == 200){
            console.log(res);
            this.TypeDialogVisible = false
            this.$message.success('代缴成功！');
            this.getData00()
              }
          })
    },
    daijiao1(row){
      this.payFrom.id = row.id
      this.TypeDialogVisible = true
    },
    // 编辑
    update(row){
      this.title = '编辑'
      this.showOpen = true
      this.showBtn = true
      // console.log(row);
      this.form = JSON.parse(JSON.stringify(row))
      getQueryName(row.type).then(res => {
        if(res.code == 200){
          this.bjForm = res.data
        }
      })
      getRegistrationXq(row.id).then(res =>{
        if(res.code == 200){
          // console.log(res);
          this.form = res.data
          for (let i = 0; i < res.data.mesList.length; i++) {
            if(res.data.mesList[i].mesType == '字典表' || res.data.mesList[i].mesType == '多选'){
              this.form[res.data.mesList[i].mesName] =  res.data.mesList[i].mesValue.split(',')
              console.log( this.form[res.data.mesList[i].mesName]);
            }
            
          }
        }
      })
      this.open = true
    },
    // 查看
    chakan(row){
      this.title= "查看"
      this.showOpen = false
      this.showBtn = false
      this.form = JSON.parse(JSON.stringify(row))
      this.open = true
    },
    uploadPicUrl(res){
        // console.log(res.data)
        this.form.url = res.data
    },
    uploadPicUrl1(res) {
      this.form.qrCode = 'http://back.9001zlsxy.com/home/pic/' + res.data
    },
    getUser() {
      let that = this
      that.payUser =  setInterval(()=>{
        that.index = that.index + 1
        if(that.index <21){
          getOrder(this.orderSn).then(res => {
            // 缴费成功
              if(res.data.state == 2){
                // that.ifMoey = false;
                that.wxDialogVisible = false;
                
                that.$message.success('支付成功！');
                clearInterval(that.payUser)
              }
          })
        }else {
          clearInterval(that.payUser)
          that.wxDialogVisible = false;
          that.$message.warning('请求超时，请联系管理员是否支付成功');
        }
      }, 3000);
    },
    // 待缴操作
    daijiao(row){
      this.wxPay = ''
      this.wxDialogVisible = true
       daijiao(row.id).then(res=>{
                if(res.code == 200){
                  this.wxPay = res.data.code_url
                  this.orderSn = res.data.serial
                  // this.crateQrcode()
                  console.log(this.orderSn);
                  this.getUser()
                }
            })
    },
    // 删除
      shanchu(row) {
      const id = row.id || this.ids;
       this.$confirm("是否确认删除?", "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(function() {
          // return delorder_school(id);
          let data = {
            id:id
          }
          delReg(data).then(res => {
            if(res.code == 200){
              console.log(res);
            }
          })
        })
        .then(() => {
          setTimeout(()=>{
            this.getData00();
            this.msgSuccess("删除成功");
          },1000)
        })
        .catch(function() {});
    },
    // 弹窗取消按钮
    openqx(){
      this.open = false
      this.getData00()
    },
    // 提交按钮
    okopen(){
      // this.form.certificateName = this.form.certificateName.toString()
      this.form.orderSource = 3
      this.form.examineStatus = 2
      // console.log(this.form);
      this.$refs["form"].validate(valid => {
        if (this.form.id != undefined) {
           if (Array.isArray(this.form.mes1)) {
                        this.form.mes1 = this.form.mes1.toString().replace(/\[|]/g, "")
                    }
                    if (Array.isArray(this.form.mes2)) {
                        this.form.mes2 = this.form.mes2.toString().replace(/\[|]/g, "")
                    }
                    if (Array.isArray(this.form.mes3)) {
                        this.form.mes3 = this.form.mes3.toString().replace(/\[|]/g, "")
                    }
                    if (Array.isArray(this.form.mes4)) {
                        this.form.mes4 = this.form.mes4.toString().replace(/\[|]/g, "")
                    }
                    if (Array.isArray(this.form.mes5)) {
                        this.form.mes5 = this.form.mes5.toString().replace(/\[|]/g, "")
                    }
                    if (Array.isArray(this.form.mes6)) {
                        this.form.mes6 = this.form.mes6.toString().replace(/\[|]/g, "")
                    }
                    if (Array.isArray(this.form.mes7)) {
                        this.form.mes7 = this.form.mes7.toString().replace(/\[|]/g, "")
                    }
                    if (Array.isArray(this.form.mes8)) {
                        this.form.mes8 = this.form.mes8.toString().replace(/\[|]/g, "")
                    }
                    if (Array.isArray(this.form.mes9)) {
                        this.form.mes9 = this.form.mes9.toString().replace(/\[|]/g, "")
                    }
                    if (Array.isArray(this.form.mes10)) {
                        this.form.mes10 = this.form.mes10.toString().replace(/\[|]/g, "")
                    }
                    if (Array.isArray(this.form.mes11)) {
                        this.form.mes11 = this.form.mes11.toString().replace(/\[|]/g, "")
                    }
                    if (Array.isArray(this.form.mes12)) {
                        this.form.mes12 = this.form.mes12.toString().replace(/\[|]/g, "")
                    }
                    if (Array.isArray(this.form.mes13)) {
                        this.form.mes13 = this.form.mes13.toString().replace(/\[|]/g, "")
                    }
                    if (Array.isArray(this.form.mes14)) {
                        this.form.mes14 = this.form.mes14.toString().replace(/\[|]/g, "")
                    }
                    if (Array.isArray(this.form.mes15)) {
                        this.form.mes15 = this.form.mes15.toString().replace(/\[|]/g, "")
                    }
                    if (Array.isArray(this.form.mes16)) {
                        this.form.mes16 = this.form.mes16.toString().replace(/\[|]/g, "")
                    }
                    if (Array.isArray(this.form.mes17)) {
                        this.form.mes17 = this.form.mes17.toString().replace(/\[|]/g, "")
                    }
                    if (Array.isArray(this.form.mes18)) {
                        this.form.mes18 = this.form.mes18.toString().replace(/\[|]/g, "")
                    }
                    if (Array.isArray(this.form.mes19)) {
                        this.form.mes19 = this.form.mes19.toString().replace(/\[|]/g, "")
                    }
                    if (Array.isArray(this.form.mes20)) {
                        this.form.mes20 = this.form.mes20.toString().replace(/\[|]/g, "")
                    }
                  getUp(this.form).then(res=>{
                      if(res.code == 200){
                          this.$message.success('编辑成功')
                          this.open = false
                          this.getData00()
                      }
                  })
                } else if(valid){
                  this.form.state = 1
                  if (Array.isArray(this.form.mes1)) {
                        this.form.mes1 = this.form.mes1.toString().replace(/\[|]/g, "")
                    }
                    if (Array.isArray(this.form.mes2)) {
                        this.form.mes2 = this.form.mes2.toString().replace(/\[|]/g, "")
                    }
                    if (Array.isArray(this.form.mes3)) {
                        this.form.mes3 = this.form.mes3.toString().replace(/\[|]/g, "")
                    }
                    if (Array.isArray(this.form.mes4)) {
                        this.form.mes4 = this.form.mes4.toString().replace(/\[|]/g, "")
                    }
                    if (Array.isArray(this.form.mes5)) {
                        this.form.mes5 = this.form.mes5.toString().replace(/\[|]/g, "")
                    }
                    if (Array.isArray(this.form.mes6)) {
                        this.form.mes6 = this.form.mes6.toString().replace(/\[|]/g, "")
                    }
                    if (Array.isArray(this.form.mes7)) {
                        this.form.mes7 = this.form.mes7.toString().replace(/\[|]/g, "")
                    }
                    if (Array.isArray(this.form.mes8)) {
                        this.form.mes8 = this.form.mes8.toString().replace(/\[|]/g, "")
                    }
                    if (Array.isArray(this.form.mes9)) {
                        this.form.mes9 = this.form.mes9.toString().replace(/\[|]/g, "")
                    }
                    if (Array.isArray(this.form.mes10)) {
                        this.form.mes10 = this.form.mes10.toString().replace(/\[|]/g, "")
                    }
                    if (Array.isArray(this.form.mes11)) {
                        this.form.mes11 = this.form.mes11.toString().replace(/\[|]/g, "")
                    }
                    if (Array.isArray(this.form.mes12)) {
                        this.form.mes12 = this.form.mes12.toString().replace(/\[|]/g, "")
                    }
                    if (Array.isArray(this.form.mes13)) {
                        this.form.mes13 = this.form.mes13.toString().replace(/\[|]/g, "")
                    }
                    if (Array.isArray(this.form.mes14)) {
                        this.form.mes14 = this.form.mes14.toString().replace(/\[|]/g, "")
                    }
                    if (Array.isArray(this.form.mes15)) {
                        this.form.mes15 = this.form.mes15.toString().replace(/\[|]/g, "")
                    }
                    if (Array.isArray(this.form.mes16)) {
                        this.form.mes16 = this.form.mes16.toString().replace(/\[|]/g, "")
                    }
                    if (Array.isArray(this.form.mes17)) {
                        this.form.mes17 = this.form.mes17.toString().replace(/\[|]/g, "")
                    }
                    if (Array.isArray(this.form.mes18)) {
                        this.form.mes18 = this.form.mes18.toString().replace(/\[|]/g, "")
                    }
                    if (Array.isArray(this.form.mes19)) {
                        this.form.mes19 = this.form.mes19.toString().replace(/\[|]/g, "")
                    }
                    if (Array.isArray(this.form.mes20)) {
                        this.form.mes20 = this.form.mes20.toString().replace(/\[|]/g, "")
                    }
                  console.log(this.form);
                  getadd(this.form).then(res=>{
                      // console.log(res,'。。。。。。。。。')
                      if(res.code == 200){
                          this.$message.success('添加成功')
                          this.open = false
                          this.getData00()
                      }
                  })
                }
      });
    },
    resetParams() {
      this.params = {
        pageNum: 1,
        pageSize: 10,
        type:undefined,
        examineStatus:2,
        state:1,
      };
      this.search();
    },
    search1(val){
      this.params.type = val
      this.getData00()
      this.getziduan()
      // console.log(val);
    },
    search() {
      this.$set(this.params, "pageNum", 1);
      this.paramsFlag = 0;
      this.getData00();
      // this.getziduan()
    },
    // 分页导航
    handlePageChange(val) {
      this.$set(this.params, "pageNum", val);
      this.getData00();
      this.getziduan()
    },
    // 选择报名项目
    changeName(val,item){
      // console.log(val,item);
      // console.log(this.options3);
      if(item.dictType == "sys_enter" && val.length == 1){
        for (let i = 0; i < item.sysDictData.length; i++) {
          if(val == item.sysDictData[i].dictLabel){
            this.form.payMoney = item.sysDictData[i].dictValue
          }
          
        }
      }else  if(item.dictType == "sys_enter" && val.length < 1){
        this.form.payMoney = 0
      }else if( item.dictType == "sys_enter" && val.length == 2){
        this.form.payMoney = this.options3[0].dictValue
      }else if( item.dictType == "sys_enter" && val.length == 3){
        this.form.payMoney = this.options3[1].dictValue
      }
    },
    xinzeng(){
      this.title= "新增"
      this.showOpen = true
      this.showBtn = true
      this.form= {
          url: "",
          realName:'',
          identityCard:'',
          qrCode:'',
          phone:'',
          certificateName:'',
          payMoney:'',
          // type:this.params.type,
          // education:'',
          // location:'',
          // title:'',
          // companyName:'',
          // duties:'',
          // invoiceStatus:0,
        mes1:'',
        mes2:'',
        mes3:'',
        mes4:'',
        mes5:'',
        mes6:'',
        mes7:'',
        mes8:'',
        mes9:'',
        mes10:'',
        mes11:'',
        mes12:'',
        mes13:'',
        mes14:'',
        mes15:'',
        mes16:'',
        mes17:'',
        mes18:'',
        mes19:'',
        mes20:'',
      }
        this.open = true
    },

    getziduan(){
      getQueryName(this.params.type).then(res =>{
        if(res.code == 200){
          // console.log(res);
          this.tableHead = res.data
        }
      })
    },
    getData00() {
      getRegistration(this.params).then(res => {
        // console.log(res, "待审核证书");
        if (res.code == 200) {
        this.tableData = res.rows
        this.Dname = this.tableData[0].name
        this.Dmobile = this.tableData[0].mobile
        this.Dnumber = this.tableData[0].number
        // this.tableHead = res.rows[0].list
          this.pageTotal = res.total;
          this.loading = false;
        }
      });
    },
    //   获取分类
    getClsss(){
        getClassList1().then(res => {
            // console.log(res);
            this.classOptions = res.data
            this.classOptions1 = res.data
            this.params1.name = res.data[0].name
            this.params.type = res.data[0].id
            this.getData00()
            this.getziduan()
            });
    },
  },
  created () {
   
    this.getClsss()
    this.getDicts('sys_cost').then(res=>{
        this.options3 = res.data
        // console.log(this.options3);
    })
  },
  mounted () {}
}
</script>
<style>
.avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
  .avatar-uploader .el-upload:hover {
    border-color: #409EFF;
  }
  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 120px;
    height: 120px;
    line-height: 120px;
    text-align: center;
  }
  .avatar {
    width: 120px;
    height: 120px;
    display: block;
  }
</style>
<style scoped>
.waitPay {
  padding: 20px 30px;
}
</style>
